****************************************************
***Table 1
use "D:\final data & dofile\city_year_data.dta"
sum mobile_sn mobile_ns mobile_nn mobile_ss home_cityID_southcity GDP_r lnGDP_r rjczyszc_qianyuan resident_million mktindex_rank l.GDPper_qianyuan fixedinvest_r rdspendsum_ct_r tpat_grant tpat_grant_r inventpat_grant inventpat_grant_r newfirm_num newfirm_num_r newipo newipo_r realestateinvest_r newhouse newhouse_r secondhandhouse secondhandhouse_r 

use "D:\final data & dofile\city_year_municipal officials(PS&mayor)_data.dta"
sum edu_first_code gdpper_3yraverage age gender_fem minority coastalprov resumeyr_south mktindex_rank_homeprov mktindex_rank_lastjobprov totalvc_inv_amount 
 
***Table 2

use "D:\final data & dofile\city_year_data.dta"
xtset cityID6 year
reghdfe lnGDP_r mobile_sn l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r home_cityID_southcity l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r mobile_sn home_cityID_southcity interaction_term l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)

use "D:\final data & dofile\city_year_party secretary_data.dta"
xtset cityID6 year
reghdfe lnGDP_r mobile_sn l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r home_cityID_southcity l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)

use "D:\final data & dofile\city_year_mayor_data.dta"
xtset cityID6 year
reghdfe lnGDP_r mobile_sn l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r home_cityID_southcity l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)

***Table 3

use "D:\final data & dofile\city_year_data.dta"
reghdfe lnGDP_r mobile#mobile_sn l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r mobile_ns l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r mobile_ss l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r mobile_nn l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe lnGDP_r mobile_sn mobile_ns mobile_ss mobile_nn l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)

***Table 4

use "D:\final data & dofile\city_year_municipal officials(PS&mayor)_data.dta"
reghdfe lnGDP_r mobile_sn edu_first_code gdpper_3yraverage l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID_ps i.year) vce(cluster cityID_ps)
reghdfe lnGDP_r mobile_sn age gender_fem minority l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID_ps i.year) vce(cluster cityID_ps)
reghdfe lnGDP_r mobile_sn coastalprov resumeyr_south mktindex_rank_lastjobprov mktindex_rank_homeprov l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID_ps i.year) vce(cluster cityID_ps)
reghdfe lnGDP_r mobile_sn edu_first_code gdpper_3yraverage age gender_fem minority coastalprov resumeyr_south mktindex_rank_homeprov mktindex_rank_lastjobprov l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank , absorb(i.cityID_ps i.year) vce(cluster cityID_ps)
reghdfe lnGDP_r mobile_sn High_Market_lastjobprov interaction_market1 l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID_ps i.year) vce(cluster cityID_ps)
reghdfe lnGDP_r mobile_sn High_Market_homeprov interaction_market2 l.GDPper_qianyuan resident_million rjczyszc_qianyuan mktindex_rank, absorb(i.cityID_ps i.year) vce(cluster cityID_ps)

***Table 5


**Column (1)
use "D:\final data & dofile\city_year_data.dta"
reghdfe fixedinvest_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)

**Column (2)
use "D:\final data & dofile\city_year_municipal officials(PS&mayor)_data.dta"
reghdfe totalvc_inv_amount mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)

**Column (3)-(10)
use "D:\final data & dofile\city_year_data.dta"
reghdfe rdspendsum_ct_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe tpat_grant_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe inventpat_grant_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe newfirm_num_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe newipo mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe realestateinvest_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe newhouse_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)
reghdfe secondhandhouse_r mobile_sn, absorb(i.cityID6 i.year) vce(cluster cityID6)

***Figure 1

use "D:\final data & dofile\city_year_data.dta"

reghdfe lnGDP_r pre_4 pre_3 pre_2 current post_1 post_2 post_3 pre_1 l.GDPper resident rjczyszc mktindex_rank, absorb(i.cityID6 i.year) vce(cluster cityID6)
coefplot, baselevels ///
keep(pre_* current post_*) order(pre_4 pre_3 pre_2 pre_1 current post_1 post_2 post_3) omitted ///
coeflabels(pre_4= "-4" pre_3= "-3" pre_2= "-2" pre_1= "-1" current= "0" post_1= "1" post_2= "2" post_3= "3") ///Change the label of the coefficient
vertical ///Transpose graphics
yline(0,lcolor(edkblue*0.8)) ///Add the dotted line y=0
xline(4, lwidth(vthin) lpattern(dash) lcolor(teal)) ///
ylabel(,labsize(*0.75)) xlabel(,labsize(*0.75)) ///The size of the horizontal and vertical coordinate axes
ytitle("lnGDP_r", size(small)) ///Add the name of the Y-axis and the size small
xtitle("Move_SN", size(small)) ///Add the name of the X-axis and the size small
addplot(line @b @at) ///Add the connecting lines between the points
ciopts(lpattern(dash) recast(rcap) msize(medium)) ///CI is sealed with a dotted line at the top and bottom
msymbol(circle_hollow) ///plot hollow format
scheme(s1mono)
